package com.sqnu.Test;

import com.alibaba.druid.pool.DruidDataSource;
import org.junit.Test;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.ResourceBundle;

public class MyTest {
    @Test
    public void jdbc(){
        ResourceBundle jdbc = ResourceBundle.getBundle("jdbc");
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName(jdbc.getString("jdbc.driver"));
        dataSource.setUrl(jdbc.getString("jdbc.url"));
        dataSource.setUsername(jdbc.getString("jdbc.username"));
        dataSource.setPassword(jdbc.getString("jdbc.password"));
        JdbcTemplate jdbcTemplate = new JdbcTemplate();
        jdbcTemplate.setDataSource(dataSource);
        int row = jdbcTemplate.update("insert into user(username,password,phone) value (?,?,?)","a1","a1","a1");
        System.out.println(row);
    }
}
